import request from '@/config/axios'

// 试题 VO
export interface QuestionVO {
  id: number // 主键
  bankId: number
  questionText: string // 题目文本
  questionType: number // 题目类型
  difficultyLevel: number // 题目难度级别
  questionUrl: string // 题目链接
  version: number // 版本号
  corrected: number
  answerKey:string
  answerUrl:string
  analysis:string
  analysisUrl:string
  questionScore:number
  selectedOptions:[]
}

// 试题 API
export const QuestionApi = {
  // 查询试题分页
  getQuestionPage: async (params: any) => {
    return await request.get({ url: `/exam/question/page`, params })
  },

  // 查询试题详情
  getQuestion: async (id: number) => {
    return await request.get({ url: `/exam/question/get?id=` + id })
  },

  // 新增试题
  createQuestion: async (data: QuestionVO) => {
    return await request.post({ url: `/exam/question/create`, data })
  },

  // 修改试题
  updateQuestion: async (data: QuestionVO) => {
    return await request.put({ url: `/exam/question/update`, data })
  },

  // 删除试题
  deleteQuestion: async (id: number) => {
    return await request.delete({ url: `/exam/question/delete?id=` + id })
  },

  // 导出试题 Excel
  exportQuestion: async (params) => {
    return await request.download({ url: `/exam/question/export-excel`, params })
  },
}
